﻿using System;
using System.Transactions;

namespace Codeflows
{
    [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
    public class TransactionalAttribute : Attribute
    {
        readonly TransactionOptions _options;

        public TransactionalAttribute()
        {
            _options = new TransactionOptions();
        }

        public TransactionalAttribute(IsolationLevel isolationLevel, 
            TimeSpan timeout)
        {            
            _options = new TransactionOptions { IsolationLevel = isolationLevel, Timeout = timeout};
        }

        public TransactionOptions Options
        {
            get { return _options; }
        }
    }
}